#pragma once

#include "NetTypes.h"

namespace phynet{
namespace net{

class Socket
{
public:
	explicit Socket(const UInt i_port = INVALID_PORT);
	bool Open(const UInt i_port);
	void Close();
	bool SendTo(const Address& i_addr, char* i_message, UInt i_messageSize);
	bool RecvFrom(Address& o_addr, char* o_message, UInt& io_messageSize);

	bool IsOpen() const {return m_isOpen;}

private:
	UInt m_port;
	bool m_isOpen;
	static UInt s_openSockets;
	static const UInt INVALID_PORT = Consts::INVALID_NUMBER;
	SocketType m_socket;

};

}} //namespaces